<?php

class Frontend_UserController extends Zend_Controller_Action {

    public function init() {
        /* Initialize action controller here */
    }

    public function indexAction() {
        // action body
    }

    public function loginAction() {
        if ($this->_request->isPost()) {
            $username = $this->getParam('username', 0);
            $password = $this->getParam('password', 0);
            $objUser = new Application_Model_User();
            if ($objUser->LoginValidate($username, $password))
                $this->_helper->redirector('index', 'post');
            else
                $this->view->error = "Wrong username or password";
        }
    }

    public function logoutAction() {
        $auth = Zend_Auth::getInstance();
        $auth->clearIdentity();
        $this->_helper->redirector('index', 'post');
    }

}
